package com.bi.onlineEducation.dao;

import com.bi.onlineEducation.domain.LoginPo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface LoginDao extends JpaRepository<LoginPo, Integer> {

    LoginPo findByLoginName(String loginName);

    @Query(value = "select * from login where login_name = :loginName and password = :password", nativeQuery = true)
    LoginPo login(String loginName,String password);

    List<LoginPo> findAllByRole(Integer role);

    List<LoginPo> findAllByRealNameLikeAndRole(String realName,Integer role);

    List<LoginPo> findAllBylAddressLikeAndRole(String address,Integer role);
}